package com.xiaoxie.quartz.service;

import com.github.pagehelper.PageInfo;
import com.xiaoxie.quartz.domain.JobEntity;
import com.xiaoxie.quartz.domain.dto.GroupDto;
import com.xiaoxie.quartz.domain.dto.JobDto;
import com.xiaoxie.quartz.domain.dto.QueryJobDto;
import org.quartz.*;

import java.util.List;

public interface QuartzService {

    void addJob(String jobClassName, String jobName, String jobGroup, String cronExpression, String description, int initStatus) throws SchedulerException, ClassNotFoundException;

    void pauseJob(String jobName, String jobGroup) throws SchedulerException;

    public void resumeJob(String jobName, String jobGroup) throws SchedulerException ;

    public void deleteJob(String jobName, String jobGroup) throws SchedulerException ;

    public void triggerJob(String jobName, String jobGroup) throws SchedulerException ;

    public void updateJob(String jobClass, String jobName, String jobGroup, String cronExpression, String description,Integer initStatus) throws SchedulerException, ClassNotFoundException;

    List<GroupDto> getAllGroups();

    List<JobDto> getJobsByGroup(String jobGroup);

    PageInfo<JobEntity> getJobList(Integer pageNum, QueryJobDto queryJobDto);

    boolean checkJobGroupAndJobName(String jobGroup, String jobName);

    boolean checkJobClassName(String jobClassName);

    boolean checkCronExpression(String cronExpression);

    JobEntity getByGroupNameAndJobName(String jobGroup, String jobName);
}
